//
//  BRMapView.h
//  BrezzeSaaS
//
//  Created by IOS on 2021/9/2.
//  Copyright © 2021 Brezze GWG. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

NS_ASSUME_NONNULL_BEGIN
@class BRMapCenterLocView;
@protocol BRMapViewDelegate <NSObject>

/// 更新后的位置
/// @param manager CLLocationManager
/// @param locations locations
- (void)br_locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations;

/// 判断是否手势触发
/// @param mapView mapView
/// @param gesture gesture
- (void)br_mapView:(GMSMapView *)mapView willMove:(BOOL)gesture;

/// 移动后触发
/// @param mapView mapView
/// @param position position
- (void)br_mapView:(GMSMapView *)mapView idleAtCameraPosition:(nonnull GMSCameraPosition *)position;


/// 点击大头针
/// @param mapView mapView
/// @param marker marker
- (BOOL)br_mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker;


@optional
/// 点击非大头针区域
/// @param mapView mapView
/// @param coordinate coordinate
- (void)br_mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate;

/// 每次移动都会触发
/// @param mapView mapView
/// @param position position
- (void)br_mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position;

/// 点击大头针详情
/// @param mapView mapView
/// @param marker marker
- (void)br_mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker;


/// 点击后显示的视图
/// @param mapView mapView
/// @param marker marker
- (UIView *)br_mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker;


@end

@interface BRMapView : UIView

@property (nonatomic,strong) GMSMapView *mapView;

@property (nonatomic,weak) id<BRMapViewDelegate> delegate;

@property (nonatomic,strong) CLLocationManager *locationManager;

@property (nonatomic,assign) CLLocationCoordinate2D myLocation;
@property (nonatomic,assign) CLLocationCoordinate2D centLocation;
/// 附近点位坐标（用于查询附近网点）
@property (nonatomic,assign) CLLocationCoordinate2D nearbySearchLocation;

@property (nonatomic,assign) BOOL gestrue;

@property (nonatomic,strong) NSArray *gmsMarkerArrs;
/// 地图是否深色
@property (nonatomic,assign) BOOL isDark;
/// 中间大头针
@property (nonatomic,strong) BRMapCenterLocView *centImgView;

// 开始定位
- (void)startUpdatingLocation;
// 停止定位
- (void)stopUpdateLocation;

- (void)requestLocation;
// 强制更新定位到当前位置
- (void)forceUpdateLocation;
// 设置地图大头针
//- (void)setGMSMarkerShop;
// 设置地图所有大头针
- (void)setGMSMarkerShop:(NSArray *)businessArr;
/// 显示当前位置的点位标记
- (void)showMyLocationMarker;
/// 显示附近网点中心标记视图（悬浮在地图上层，永远居中，点位对应地图中心坐标）
- (void)showNearbySearchMarker;


- (void)resetGoogleBtn;
// 暗色和default切换
- (void)resetMapStyle;


- (void)changeShadowDrak;

- (void)resetGoogleBtn:(BOOL)small;
- (void)resetGoogleBtnY:(CGFloat)y;
/// 移动中心
- (void)br_animateToCameraPosition:(CLLocationCoordinate2D)Coordinate;

@end

@interface BRMapCenterLocView : UIView

@property (nonatomic,strong) QMUILabel *titleL;
@property (nonatomic,strong) UIImageView *topImg;
@property (nonatomic,strong) UIImageView *centerImg;
@property (nonatomic,strong) UIView *imgBgView;
@property (nonatomic,copy) BRVoidBlock topClickBlcok;

@end

NS_ASSUME_NONNULL_END
